<template>
  <view>
    <view class="my-search-container" :style="{'background-color':bgcolor}" @click="searchBoxHandler">
      <view class="my-search-box" :style="{'border-radius':radius+'px'}">
        <uni-icons type="search" size="17"></uni-icons>
        <text class="search">搜索</text>
      </view>
    </view>
  </view>
</template>

<script>
  export default {
    name:"my-search",
    props:{
      // 背景颜色
      bgcolor:{
        type:String,
        default:"#c00000"
      },
      // 圆角尺寸
      radius:{
        type:Number,
        default:20 //单位px
      }
    },
    data() {
      return {
        
      };
    },
    methods:{
      searchBoxHandler(){
        // console.log('~~~~')
        // 自定义组件外定义事件的绑定方式（事件名可以随便写）
        this.$emit('click')
      }
    },
  }
</script>

<style lang="scss">
  .my-search-container{
    // background-color: #c00000;
    height: 50px;
    line-height: 50px;
    display: flex;
    justify-content: center;
    align-items: center;
    .my-search-box{
      height: 40px;
      line-height: 40px;
      width: 95%;
      background-color: #fff;
      text-align: center;
      // border-radius: 20px;
      .search{
        font-weight: 400;
        margin-left: 5PX;
      }
    }
    
  }
</style>
